package com.zego.wawaji.socket;

import com.zego.wawaji.base.utils.Hosts;

/**
 * socket长连接中一些常用的常量
 */
public class TCPConstant {
    // 服务端设备ID，Tcp建立长连接时由服务器分配，心跳时以该ID做为服务端设备唯一标识
    public static long serverID = 0;

    // socket连接地址
    public static String HOST = Hosts.FATE_IT_TCP;    //socket连接IP地址
    public static int PORT = Hosts.FATE_IT_TCP_PORT;                    //socket连接端口

    // -------------------------- MsgType常量 -------------------------
    // 软件内部消息  1000 - 1999
    public static final int MSG_ID_LOGIN_SUC = 1000;           // 注册登录成功
    public static final int MSG_ID_HEART_BEAT = 1001;     // 表示用户的前端状态 1为前端在线 2为非前端在线 用户切换前端状态时需要发一次心跳消息
    public static final int MSG_WAWAJI_STATUS = 3008;     // 娃娃机房间状态

    public static final int MSG_TIPS_MSG = 1009;      // 全局通知消息
    public static final int MSG_NOTIFICATION = 1016;      // 广播推送
    public static final int MSG_WEB_REFRESH = 1017;       // 刷新WEB页通知
    public static final int MSG_COUPON = 1018;            // 优惠券消息
    public static final int MSG_FIRST_PAY = 1019;         // 首冲开宝箱消息

    // 服务器推送消息: 100-200
    public static final int MSG_ID_SERVER_PUSH_START_INDEX = 100;//服务器推送消息，开始id
    public static final int MSG_ID_SERVER_PUSH_END_INDEX = 200; //服务器推送消息，结束id（暂定）
    public static final int MSG_ID_PUSH_MESSAGE = 102;      //服务器推送的消息
    public static final long Heartbeat_Time = 60 * 1000;    //心跳时间间隔，60s

    /**
     * 即时通许中，CoreService连接服务器时，返回的几种状态。
     */
    public static final int SOCKET_STATUS_Login_Success = 0;    //登录成功
    public static final int SOCKET_STATUS_Login_Fail = 1;       //登录失败
    public static final int SOCKET_STATUS_Connected = 2;        //连接成功
    public static final int SOCKET_STATUS_Disconnect = 3;       //断开连接
    public static final int SOCKET_STATUS_ConnectIng = 4;       //正在连接

    /**
     * [消息体长度（4Bytes）][客户ID（4Byte）][消息类型 (2Bytes)][内容]
     */

    public static final int SOCKET_CONNECT_TIMEOUT = 5000;             //Socket连接时超时时间
    public static final int SOCKET_AUTO_CONNECT_Increment_Time = 1000;  //Socket自动重连时间间隔
    public static final int SOCKET_CONNECT_Heartbeat_Time = 30 * 1000;  //连接服务器的心跳间隔
}
